<?php
include("include/conn.php");

if(isset($_GET['rojmelId']))
{
  //Delete record from Rojmel Table : Starst
  $deleteRojmel = "DELETE FROM rojmel 
                    WHERE rojmelId = ".$_GET['rojmelId'];
  $deleteRojmelRes = mysql_query($deleteRojmel);
  //Delete record from Rojmel Table : Ends
  
  //Delete record from Vepaari Table : Starst
  $deleteFromVepaari = "DELETE FROM vepaaribilldetail 
                         WHERE rojmelId = ".$_GET['rojmelId'];
  $deleteFromVepaariRes = mysql_query($deleteFromVepaari);
  //Delete record from Vepaari Table : Ends
  
  //Select and Delete record from Kaarigar Table : Starst

  $deleteFromKaarigarDetail = "DELETE FROM kaarigardetail 
                                WHERE kaarigarMasterId = (SELECT kaarigarMasterId 
                                                            FROM kaarigarmaster 
                                                           WHERE rojmelId = ".$_GET['rojmelId'].")";
  $deleteFromKaarigarDetailRes = mysql_query($deleteFromKaarigarDetail);
  
  $deleteFromKaarigarMaster = "DELETE FROM kaarigarmaster 
                                WHERE rojmelId = ".$_GET['rojmelId'];
  $deleteFromKaarigarMasterRes = mysql_query($deleteFromKaarigarMaster);
  //Select and Delete record from Kaarigar Table : Ends
  
  //Delete record from Bullionmaster Table : Starst
  $deleteFromKaarigarDetail = "DELETE FROM bulliondetail 
                                WHERE bullionmasterid = (SELECT bullionmasterid 
                                                           FROM bullionmaster
                                                          WHERE rojmelId = ".$_GET['rojmelId'].")";
  $deleteFromKaarigarDetailRes = mysql_query($deleteFromKaarigarDetail);
  
  $deleteFromBullionMaster = "DELETE FROM bullionmaster 
                               WHERE rojmelId = ".$_GET['rojmelId'];
  $deleteFromBullionMasterRes = mysql_query($deleteFromBullionMaster);                         
  //Delete record from Bullionmaster Table : Ends
  
  //Delete record from Bhatthi Table : Starst
  $deleteFromBhatthi = "DELETE FROM bhatthibookdetail 
                              WHERE rojmelId = ".$_GET['rojmelId'];
  $deleteFromBhatthiRes = mysql_query($deleteFromBhatthi);                         
  //Delete record from Bhatthi Table : Ends
}
header("location:rojmel.php");
?>